package ru.jexp.rcp.supply.dirty;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import ru.jexp.obekt.identifikacia.IIdentificiruemii;
import ru.jexp.rcp.supply.editor.JExpEditorPage;

public class DirtyModifyListener extends SelectionAdapter implements
		ModifyListener, IDirtyListener {

	private final JExpEditorPage<? extends IIdentificiruemii> editor;

	public DirtyModifyListener(
			JExpEditorPage<? extends IIdentificiruemii> editor) {
		this.editor = editor;
	}

	@Override
	public void modifyText(ModifyEvent e) {
		dirty();
	}

	@Override
	public void widgetSelected(SelectionEvent e) {
		dirty();
	}

	@Override
	public void dirty() {
		editor.notifyFirePropertyChange();
	}

}
